package com.yunupmall.controller.amdin;

import com.yunupmall.entity.admin.commoditypojo.PayConcetion;
import com.yunupmall.service.admin.impl.PayConcectionimpl;
import com.yunupmall.uits.ReturnData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class PayConcectionController {
    @Autowired
    PayConcectionimpl payConcectionimpl;

    @RequestMapping("/getDatathis")
    public String getDatathis(@RequestParam("thispage") Integer thispage, @RequestParam("sizepage") Integer pagesize) {
        int counts = payConcectionimpl.getCounts();
        List<PayConcetion> allData = payConcectionimpl.getAllData((thispage - 1) * pagesize, pagesize);
        String returnData = ReturnData.getReturnData(counts, allData);
        return returnData;
    }

    @RequestMapping("/addPaytarget")
    public void addPaytarget(@RequestParam("patName") String patName,
                             @RequestParam("patTatgerName") String patTatgerName,
                             @RequestParam("time") String time,
                             @RequestParam("text") String text) {
        int i = payConcectionimpl.addData(patName, text, time, patTatgerName);
    }
}
